using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableProvince
	{
		public const string Table = "Province";
		public const string ProvinceID = "ProvinceID";
		public const string ProvinceName = "ProvinceName";
	}
	
	[Serializable]
	public class BaseProvince
		: IDbSessionEntity, IJsonClass
	{
		int m_ProvinceID;
		/// <summary>
        /// 省份表ID
        /// </summary>
        public int ProvinceID
        {
            get { return m_ProvinceID; }
            set { m_ProvinceID = value; }
        }
		
		string m_ProvinceName;
		/// <summary>
        /// 省份名称
        /// </summary>
        public string ProvinceName
        {
            get { return m_ProvinceName; }
            set { m_ProvinceName = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_ProvinceID = reader[TableProvince.ProvinceID];
            m_ProvinceName = reader[TableProvince.ProvinceName];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableProvince.ProvinceID, PrimaryKeyType.Identity, ProvinceID);
			writer[TableProvince.ProvinceName] = ProvinceName;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_ProvinceID = idd;
        }
		
		public string TableName
        {
            get { return TableProvince.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_ProvinceID = hashToRead["ProvinceID"];
			 
             m_ProvinceName = hashToRead["ProvinceName"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["ProvinceID"] = ProvinceID;
			 
            hashToFill["ProvinceName"] = ProvinceName;
			 
        }

        #endregion
		
	}
}
